<template>
  <main class="wss-container">
    <ComTabs
      @EventSelectTab="currentSelect"
      :activeName="activeName"
      :tabList="isEditLook() ? tabListNoEdit:tabList"
    ></ComTabs>
    <Agreement v-if="activeName == 'agreement'"></Agreement>

    <Help v-else-if="activeName == 'help'"></Help>
    <Entity v-else-if="activeName == 'entity'"></Entity>
    <!-- <ItemSetting v-else-if="activeName == 'ItemSetting'"></ItemSetting> -->
    <Business v-else-if="activeName == 'business'"></Business>
    <MessageSet v-else-if="activeName == 'messageSet'"></MessageSet>
    <WisBudget v-else-if="activeName == 'wisBudget'"></WisBudget>
    <SystemEmail v-else></SystemEmail>
  </main>
</template>

<script>
import Help from "@/wss/newViews/product/else/help.vue";
import Entity from "@/wss/newViews/product/else/entity.vue";
import Agreement from "@/wss/newViews/product/else/agreement.vue";
import Business from "@/wss/newViews/product/else/business.vue";
import WisBudget from "@/wss/newViews/product/else/wisBudget.vue";
import SystemEmail from "@/wss/newViews/product/else/systemEmail.vue";
import ComTabs from "../../../components/ComTabs.vue";
// import ItemSetting from "@/wss/newViews/product/else/itemSetting.vue";
import MessageSet from "./messageSet.vue"

export default {
  components: {
    Help,
    Entity,
    Agreement,
    Business,
    WisBudget,
    ComTabs,
    MessageSet,
    SystemEmail
  },
  data() {
    return {
      activeName: "agreement",
      // tab页数据
      tabList: [
        {
          label: "协议设置",
          name: "agreement",
        },
        {
          label: "帮助设置",
          name: "help",
        },
        {
          label: "商机设置",
          name: "business",
        },
        {
          label: "实体设置",
          name: "entity",
        },
        {
          label: "消息设置",
          name: "messageSet",
        },
        {
          label: "阿米巴预算",
          name: "wisBudget",
        },
        {
          label: "系统邮箱",
          name: "systemEmail",
        },
        // {
        //   label: "项目设置",
        //   name: "ItemSetting",
        // },
      ],

      // 协议维护员只能看到协议的内容
      tabListNoEdit: [
        {
          label: "协议设置",
          name: "agreement",
        },
      ],
    };
  },
  methods: {
    currentSelect({ label, index, name }) {
      this.activeName = name;
    },

    // 协议维护员只能看到协议的内容
    isEditLook(){
      let roles = this.$store.state.user.roles
      if(roles.includes('xywhz')){
        return true
      }else{
        return false
      }
    },
  },
};
</script>

<style scoped>
.wss-container {
  display: flex;
  flex-direction: column;
}
.wss-container .el-tabs {
  height: 40px;
  margin-bottom: 20px;
}
</style>